DeskEdit 4

An advanced all-purpose program and text editor for Acorn 32-bit Computers

Supplement: Upgrading from DeskEdit 2


DeskEdit 4

by Lee Calcraft

Note: clicking on references from the following list will take you to the appropriate section, whilst clicking on the main headings within the manual will return the view to this list of contents.

Contents

1.

General Release and Installation Notes

2.

Features of DeskEdit 4 Not Covered in the Manual

2a

The Break Key

2b

New Features Controlled from the Keyboard

2c

Viewing Functions

2d

Setting Display Width

2e

New Invisible Markers

2f

20-Entry Debugger and User Scroller

2g

Quick Search

2h

Quick Search wild cards

2i

Extended File Info

2j

Safe Saves

2k

Overrides

2l

Input/Output Filters

2m

File Normalisation

2n

Auto Indents for Basic Structures

2o

The C Syntax Checker

2p

C Indenting and 'if' Handling

2q

Task Windows

2r

Clever boots

2s

Save and Run

2t

Key macros - keystroke recording

2u

Auto-finder for Basic Errors

2v

A General goto

2w

Printer Fixes

2x

Minor Features

Section 1:
General Release and Installation Notes

Installing DeskEdit
Before using DeskEdit, please run the ReadMe application on the DeskEdit disc by double-clicking on its icon in the directory viewer. This application will tell you about any recent enhancements or modifications to DeskEdit.

To run DeskEdit, insert the DeskEdit disc into your disc drive, and click on the floppy drive icon. Then double-click on the DeskEdit icon in the directory viewer. This will install DeskEdit's icon on the icon bar.

If you get the error message "C Library is out of date" when you first run DeskEdit, you will need to update your current version of the C Library file CLib (see below).

To install DeskEdit onto a hard disc, simply open the target directory on your hard disc, and drag DeskEdit's icon from its directory viewer on the DeskEdit floppy disc to the required destination.

Installing Find
Acorn's Find application supplied with DeskEdit may be run by double-clicking on its icon in a directory viewer; and may be transferred to a hard disc in the usual way. To run Find you will also need the Find utility (supplied in the LIBRARY directory of the DeskEdit disc) installed in your current library. If you do not have a library set up, create a new directory called LIBRARY in the root directory of your work disc, and copy the Find utility into it. If you do not do this, Find will complain that it can't find a file called 'Find'.

Note that Acorn's Find application has two quirks:

  1. If you have BugBuster installed, Find sometimes fatally crashes when installed. Just install it again, and all will be well.
  2. If there are any control codes in lines of text containing a match, Find will report the find, but will not generate any throwback, so DeskEdit (or SrcEdit) will not be able to pick it up.

Updating !System
A special application called !Merge is supplied on the DeskEdit disc for updating your !System application so that it contains the latest version of the C library CLib and other relevant modules. You only need to follow this procedure if when you first run DeskEdit you get a message to the effect that your version of CLib is out of date, or if the Find application supplied with DeskEdit complains that certain modules are missing or out of date.

To update your !System application, first remove any applications which you may have running from the Desktop (since changing CLib while they are running could cause them to crash), then double-click on the !Merge application, and follow the instructions which appear in the dialogue box. Essentially you must first drag your own !System application to the Merge dialogue box, and then drag the New DeskEdit !System to it - and the job will be done for you. You will be prompted to insert floppy discs, as appropriate.

Section 2:
Features of DeskEdit 4 Not Covered in the Manual

The major new features are as follows:

2a The Break Key

To facilitate future developments of the operating system by Acorn, the Break key is no longer used by DeskEdit. To unmark a block of marked text you should use Escape-Escape (i.e. hit Escape twice in succession). If you experience trouble in timing the double hit, hold the Escape key down for slightly longer on the first of the two hits. To park the mouse pointer hold down Escape, and press the right-hand Ctrl key.

2b New Features Controlled from the Keyboard

DeskEdit 4 boasts many new features not documented in the accompanying manual. Here is a summary of the new keyboard shortcuts:

Escape-FReturn to where Ctrl (Sh) F was last issued
Escape-UpReturn to where Ctrl-Up was last issued
Escape-DownReturn to where Ctrl-Down was last issued
Escape-BInsert "break;" when in C mode
Escape-LLoad a file into a new window
Escape-[Remove "REM " in Basic or "/*" and " */" in C
Escape-]Ditto, then move down one line
Escape-MMarks from the caret to the end of a line
Ctrl-GGo to Basic error line (see below)
Ctrl-Sh-GGo to user-goto line (see below)
Escape-GReturn to where Ctrl-(Sh)-G was last issued
Escape-TabRight align C comments (see below)
<Righthand-Shift><Left-Cursor>Go to start of word
<Righthand-Shift><Right-Cursor>Go to end of word
Escape-.Return to where last specific finder issued
Escape-Q,W,E,R,T,Y,U,I,O,PRecord/Playback key macros
Escape-keypad-0 to 9Twenty new invisible markers
Ctrl-Sh-KCentre a line of text (was Escape-R)
Escape-EscapeUnmark text
Escape-BreakPark the mouse
Ctrl-AGo to matching PROC/FN definition (Basic or C)
Escape-AReturn to where Ctrl-A called from
Ctrl-Sh-AReturn to last PROC/FN defn called from Ctrl-A
Escape-ReturnToggles Auto-Indent
Ctrl-Sh-ReturnDo a newline with indent
Sh-ReturnDo a newline with reduced indent
Ctrl-EGo to the next closing brace at the start of a line (in C only)
Ctrl-Sh-EAs Ctrl-E but search upwards through text
Ctrl-WOpens a new view.
Ctrl-Sh-WOpens a new view with the caret at the procedure or function definition which matches the string at the caret (Basic and C)

Additional Notes
Please note that the menu structure has been altered to make the main window menu more compact, placing a number of features in the new submenu entry, Misc edit.

Basic's function Browser now uses Ctrl-F and Ctrl-Shift-F (previously Ctrl-D and Ctrl-Shift-D). This makes it consistent with the C equivalent, and frees Ctrl-D for date insertion in Basic. Ctrl- (Shift) P is no longer supported in Basic (since this was of little use).

Close window has been moved to Escape-F8 (to clear the way for the Browsers on F2).

Ctrl-Select on the "OK" button of the Hardcopy dialogue box sets back the defaults, without performing any other action.

Additionally, clicking with Adjust on a function name listed in the Function Browser (Shift-F2), opens a new window on the named function.

Templates use a standard size window for text, but small windows can be obtained by deleting Templates0 (in the !DeskEdit directory) and renaming TemplatesX to Templates0.

2c Viewing Functions

Three new keyboard shortcuts have been introduced to make it easier to move to procedure and function definitions. If you place the caret to the left of the name of a function or procedure, and press Ctrl-A you will be taken to its definition.

Once a definition has been found, two further keys may be used at any time:

Escape-Atakes you back to the line from where the function was originally called (i.e. where you originally hit Ctrl-A)
Ctrl-Shift-Atakes you to the definition (regardless of caret position)

A further feature of the Ctrl-A set of functions is that Ctrl-N (Next find in Quick Search) can be used to find a further matching function definition after Ctrl-A. This is particularly handy if you are working with a number of source files, and the file containing the call does not contain the function definition. Just give input focus to further files and press Ctrl-N (or even Ctrl-Shift-N to search upwards).

2d Setting Display Width

It was possible to set the so-called window work area Display width in DeskEdit 2 (from the window menu entry Display ->Work Area). This is the maximum character width of a window. By contrast the so-called Format width is the width used when formatting word-wrapped text, or when right-aligning etc.

With DeskEdit 4 the Display width of any given file is automatically saved during an extended save (just as Format width was on DeskEdit 2). This means that if you want to use a Display width for a particular file which is different from the default, you can set this once and for all, and it will be reinstated each time your file is loaded back in (providing that you have extended saves set up).

The Display width is now controlled from the new key combination Escape-F7, which brings up a writable dialogue box showing the Display width of the current window, and allows you to set it to some other value. It should be stressed that values set in this way will not affect the default value of the Display width (i.e. as applied to new files, or to newly loaded files which do not have suitable extended-load data).

The default value can be set for the current session by using the window menu entry Display->Work area. To alter the default more permanently, you can use the undocumented 'A' option in the DeskEdit$Options.

These options are covered in the main manual. But to give an example, the following line:

in DeskEdit's !Run file will set the foreground and background colours as normal, but will additionally set the default Display width to 73.

Note that Acorn's RISC OS library (used by DeskEdit) imposes an upper limit to the Display width of 192 characters. Text beyond this limit is simply not displayed on screen.

2e New Invisible Markers

20 new invisible markers have been added to DeskEdit. Ten of them are used to take you to a previously marked position, while the remaining ten mark the calling position so that you can move between any pair of positions with ease. They work in the same way as the markers on F9 and F10, but use the Escape key together with the ten number keys on the numeric keypad.

Escape-Shift-n inserts a mark associated with number key n
Escape-n takes you to a previously remembered position
Escape-Ctrl-n takes you back to where you were before you pressed Escape-n.

So, for example, hold down the Escape and Shift keys, and hit the zero on the numeric keypad. This will insert a mark at the current caret position (a beep will confirm this setting).

To return to that position at any time, just hold down Escape and hit zero on the numeric keypad.

If you want to go back to where you were before you hit Escape-0, simply press Escape and Ctrl together, and hit zero.

This is duplicated for all ten numeric keypad keys 0-9. And these marks are window specific - so you can have a set of ten for each window that is open. This is in addition to the markers on F9, F10 and Home.

Moreover, all these markers are saved when you perform an extended save, so they will all be in place when you next load your files.

2f 20-Entry Debugger and User Scroller

Two user-dedicated windows are provided in DeskEdit which may be written to using a variety of library functions, supplied in Basic and C which can send Wimp messages to DeskEdit.

A primary use for both windows will be program debugging on the desktop, since the functions and procedures supplied allow variable data and other information to be sent from a Wimp program under test to either of the two dedicated windows. But the scroller may also be used to provide a text display window for simple Wimp programs which lack their own display code.

Once the library functions have been included in a program, output can be generated by simple calls such as the following:

When this is executed, DeskEdit's scroller window will open, and a line containing the words "This is a test" will be added to the display.

Alternatively:

will display the value of "x" on line 9 of the debugger.

In C there is the added flexibility of variable arguments, so you could use:

for example, to display the values of x, y and string all on a single line.

Additional procedures allow both windows to be cleared by calls from within the client program:

for Basic, and:
from C.

Note that the Debugger and Scroller are controlled from DeskEdit's icon bar menu, and are only made active by ticking these entries. The state of these two options is saved when you save your current choices (from Choices in the same menu).

Both the Debugger and the Scroller windows have their own short menus offering the following three options:

The first two options behave as expected. The third determines whether the associated window will be brought to the top of the stack whenever it is written to. It is useful to have this option set (ticked) when important debugging information is being displayed, but for other uses it can be too intrusive. The state of this option for both scroller and debugger windows is saved when you save your current choices, and is restored when DeskEdit boots up.

For exact details of how to send messages to the two windows, you should examine the library files in the directory:

2g Quick Search

This has been improved in a number of ways. Firstly if you use Shift-F4 to automatically pick up marked text and insert it in the Quick Search target string, if there is no text marked in the vicinity of the caret (within 50 chars) or if the text contains only spaces or is only one character in length, the string to the right of the caret will be grabbed instead. Punctuation and brackets are taken to be terminators, so if you place the caret to the left of:
The string:
will appear in the target writable icon. This allows you to find all calls to this function. Remember that if you press Ctrl-Return to start the search it will start from the top of text, while Shift-Return will find only procedure and function definitions (the two may be used together).

A second new feature permits you to limit the range of a Quick Search. If you press Enter (or any Shift/Ctrl combination with Enter) to initiate a Quick Search (instead of Return), then the search will end as soon as it hits marked text. So, to search for the occurrence of a variable within a particular function, move to the end of it, and mark one or more characters (e.g. with Ctrl-M). Then move to the start of the function (using Ctrl-Shift-F takes you straight there), then do your Quick Search.

2h Quick Search wild cards

Up to now DeskEdit's Quick Search has always assumed a wildcard at the start and end of each entered string. With DeskEdit 4 this is now controlled by option icons in the Quick Search dialogue box, and the state of these two options is saved with a Choices save (from the icon bar menu).

The new non-wildcard search has been implemented in a special way to assist programmers in both C and Basic who want to search for particular variable names etc (though it will also be useful in Text mode). It is designed to enable you to find, for example, all references to the variable i without finding anything else which happens to contain the letter i.

Thus for example in earlier Quick Searches, if you opted to search for i, you would get every word with i in it. By turning off the wildcards at the start and end of the search string you can specify a search for i, and this will find all cases where the variable name i has been used, including:

but excluding PROCi, my_i and ii etc.

In Basic it is currently fooled by placing variable names immediately adjacent to Basic keywords, as in:

2i Extended File Info

Dragging a file to the DeskEdit icon on the icon bar with Alt pressed will give info on the file, as before. But now if Shift is pressed as well - i.e. drag with Alt-Shift pressed - extended file info is given for certain types of file as follows:

ModuleVersion number & date
List of addresses of major blocks
List of star commands
SpriteList of sprites contained within the file with size, mode, mask and palette details of each
TemplateList of windows contained, with no of icons in each
PCXVarious image data, including size and number of colours
BasicDisplays REMs in the first 10 lines plus tot no of lines in the program
SquashDisplays original filetype and original datestamp and length
ReplayDisplays the full header information

2j Safe Saves

Safe Saves have been implemented in DeskEdit. If for example the following override (see below) is set:
each time a file is saved from DeskEdit, if a file of the same name already exists on disc, it will be renamed with the supplied name (i.e. adfs::0.$.SAFEsave.LastSave in the example) immediately before the save takes place.

Alternatively, if you supply a pathname only for a safe save (i.e. a name ending in a full stop) - for example:

The real leafname of each file will be saved in the SAFEsave directory.

Again, what is saved is the file that would have been overwritten by a save. So for example, if you first save a document called my_text, it will appear only in the directory to which it was dragged. Suppose you now edit it, and then save the updated version. The SAFEsave directory will now hold the original version. A third save of the edited file will cause the second version to be retained in the SAFEsave directory, while the first version will be lost, and so on.

Using the safe saver in this way inevitably means that you will need to manually clear out the nominated directory from time to time - in particular, when you have made safe saves on the ADFS filing system of 77 files with different names - though a better option is to rename it as a file archive, and to create a new safe save directory.

2k Overrides

An Overrides file is now implemented. This is called Overrides, and resides in the DeskEdit Choices directory (i.e. !DeskEdit.Choices.Overrides). It specifies in ASCII format overrides which may be applied to certain DeskEdit features, and is read once only when DeskEdit boots up. If there is no entry for any given override, then the default value of the particular parameter is used.

The supplied Overrides file is fully commented (comments may be placed on any line beginning with a forward slash (/), and should prove helpful when editing overrides). The last line of the Overrides file should be the line:

The Overrides:

1. Browser note strings - this specifies the strings that the Browser will use to indicate that a line is a remark line. For example:

where "X" represents the printer hide character generated by pressing Escape-£.

2. Place finder base strings - this specifies the strings that the place finder uses as its base. For example:

This would mean that in Basic for example, if you pressed Escape-$, DeskEdit would try to take you to a line containing the marker string:
and so on.

3. Clipboard linefeeds - if this is set, then any string that you add to the clipboard (with Ctrl-Sh-Z) will have a linefeed added to it if there is not one already. This is handy for collecting parts of lines to use elsewhere.

4. C Comment String - this tells the C syntax checker that lines starting with the specified string are to be treated as comment lines (in addition to the ANSI standard "/* */").

This allows you to indicate remark lines that may fall a long distance after the remark opener "/*". For example, if you supplied <space>*<space> as follows:

then the checker would ignore the following:

5. Basic Assembler Labels - If this is set, then when function searches are carried out in Basic mode (e.g. from Ctrl-F, or using the Function Browser or Ctrl A, or a Quick Search executed with Shift-Return), a line which begins with a full stop and contains the target string will also be counted as a match.

This means that you can use Ctrl-F to move from one label to the next, or that you can place the caret to the left of a label name (as in BL loop_start) for example, and Ctrl-A will take you straight to the label (with Esc-A taking you back again).

Syntax:

6. Safe Saves - The pathname for safe saves is specified as in the following example:

It must end in a full stop.

Alternatively you can specify a single filename, as for example:

This will mean that all safe saves will take place to this filename.

If there is no safe save entry in the overrides file, safe saves will not take place.

7. Printer Formfeeds and Endfeeds - the override printer_formfeeds can now be set to "yes". This simply replaces the very last line-feed on each page with a page-feed, and avoids the problem with some drivers which resulted in double page feeds (see section 2k for a slightly fuller explanation).

Additionally the override printer_endfeeds can be set to "no" to stop the last page being pushed out. The drivers normally issue a page feed as part of the end of job sequence, so this avoids a double page at the end.

2l Input/Output Filters

It is now possible to nominate files of specific filetypes for automatic filtering when loading into DeskEdit and saving from it. The filter is able to remove carriage return characters (hex 0D) within a file and replace them if necessary with linefeeds. It can expand tab characters, and remove DOS end of file characters.

Exactly what filtering takes place on input is retained, and applied in reverse during a save (except that spaces are not converted back to tabs). This is effective on all saves from F3 - including Escape-saves and Backup saves.

One of the principal uses of the filter system is for the automatic translation of files from a PC environment, but it has other uses too.

The filter is driven by a file in the Choices directory named:

which gives a list of filetypes which are to be filtered on loading and unfiltered on saving, and which indicates what kind of filtering is to take place. A maximum of 20 filetypes may be specified in the filter list.

The default filter file reads as follows:

The first two lines must be present, and should not be altered. Any number of comment lines may be included, providing they begin with a forward slash. The last line of the file should be:

The keyword verbose ensures that when a file is filtered on loading, a small dynamic info box will warn you that this has occurred. If you want to turn this off, simply precede the word with a forward slash.

The data which actually specifies what filtering will take place consists of a filetype followed by a colon. The optional number following the colon is the number of spaces to use when replacing tabs. If there is no number, tabs will not be replaced. For example:

means filter all files of type &fe4 (DOS), and replace tabs with a double space.

To override filtering or defiltering, use the Ctrl key. Thus if you drag a file that would normally be filtered to DeskEdit's icon on the icon bar with Ctrl held down it will be loaded without filtering. If you hold down the Ctrl key while dragging a file's icon from DeskEdit's save box (generated by pressing F3) to the filer, it will not be defiltered, even if it had been filtered on input to DeskEdit.

2m File Normalisation

Shift-F5 will now Normalise the text in a window, removing CR characters and replacing them if necessary with linefeeds, expanding tabs (to the value of the default indent), and removing end of file markers. The changes are not recorded in the internal filter data for that file, so that no attempt is made to reinstate these features when the file is subsequently saved. Again this feature should completely normalise files from the PC environment, as well as other non-conforming files.

2n Auto Indents for Basic Structures

Auto indents are now implemented for Basic structures. If you press Return on a line containing REPEAT (not followed by UNTIL) then the following line will be indented by the auto indent amount (set from the Choices dialogue box) - assuming that Auto-indents are turned on for Basic (Escape-Return toggles).

As an example, the following indents would be automatically generated:

All reductions in indent must still be generated by the user (just by pressing Shift-Return instead of Return on its own), simply because even DeskEdit is not yet fully prescient!

2o The C Syntax Checker

This has been reworked to check on a much wider range of common syntax errors in C source code, and at the same time to improve the accuracy of its reporting. It is necessary to emphasise however that in C, errors are context sensitive, and that since checking is performed as you type, it is not possible to make extensive checks on the context of any given line of code.

The checker in DeskEdit therefore makes compromises, but can nevertheless spot many common errors, and warn you of them before you compile. A wide range of common syntax errors are checked, including missing terminating semicolons, or colons where appropriate. brackets and quotation marks are matched over multiple lines, 'if', 'for', 'do' and 'while' statements are checked for correct logical operator etc.

When any key is pressed, a "changed text" flag is set, and if it is set when any vertical movement is made to the caret (eg by cursor up or down, page up or down, F9 position finder etc.) - or when a save is instigated, a syntax check is carried out. Syntax checking can also be forced with Ctrl-Q. This does a Quick check on a line, and moves the caret downwards.

The checker now uses a different technique for checking multiple statement lines, and can cope with comments within such lines. When multi-statement lines are used, you can assist the checker by using the ANSI approved preprocessor symbol of a backslash "\" at the end of each incomplete line. This lets the checker know that it should for example hang fire until you have finished typing the next line before it complains of unmatched brackets etc.

Bracket matching (which works from Ctrl-( in both Basic and C modes) has also been improved, and is no longer fooled by chars such as "c='{'", '}', '\"' etc.

Note that if you use the keyboard shortcut ctrl-[ to open a comment, an indicator remains on screen to remind you that syntax checking is in abeyance.

When you are working near the end of the file it checks that the last character in the file is a linefeed (the compiler insists on this and faults any file where this is not the case).

An override permits a user-defined string of up to 6 chars to indicate a remark line (see Overrides above).

Lines beginning with # are not checked at all now.

2p C Indenting and 'if' Handling

A new feature introduced with DeskEdit 3 is that Shift-Ctrl-Return performs a new line with increased indent. To toggle auto-indent on and off (previously controlled by Ctrl-Sh-Return), use Escape-Return.

If you press Ctrl-Sh-Ret on an 'if' statement without a closing semicolon, no opening brace will be generated (and no error will be signalled) - instead the next line will be indented. This is useful since otherwise the checker has no idea whether you require a brace or not.

2q Task Windows

Task windows can be handy in lots of ways, and are now implemented with DeskEdit 4. They work in a similar way to Edit, but with a number of very useful extra features. To create a task window, either install DeskEdit and select Task Window from the icon bar menu, or simply press Ctrl-F12 in the normal way. This will load DeskEdit if it is not already on the icon bar, and open a task window. If Edit loads onto the icon bar instead, it is simply that DeskEdit has not yet been seen by the Filer - so open a directory containing DeskEdit, and press Ctrl-F12 again.

From a DeskEdit task window you can do all the normal things, like make a system call (e.g. type Cat to catalogue your current directory). Additionally the function keys F1 to F8 are available as programmable keys. Function keys F9 to F11 behave as they normally do in DeskEdit, so you can place markers and so on without having to unlink the task window first.

You will also find that the cursor keys are active in DeskEdit task windows (they are not in Edit), so it is easy to move around and look at parts of the window that have scrolled out of view. All Ctrl keys are also active - so you can mark a line with Ctrl-Sh-M for example as you would normally in a DeskEdit window.

Additionally the normal copy editing and the clipboard are continually active. This means that if you are testing out a command - e.g. a sound command, you do not need to retype it every time - just mark it either with the mouse, or with Ctrl-M or Ctrl-Sh-M, then press Ctrl-B or Ctrl-C to copy it down to the command line. And if the line contains a carriage return - as it would if you selected it with Ctrl-Sh-M or treble-clicked with the mouse - then the line will not only be copied, it will also be automatically executed. You can also copy from any other DeskEdit window in this way.

You can even execute all the commands in an Obey file by dragging it to the task window directly from the Filer.

2r Clever boots

You can boot up with one or more task windows open by including the switch "-tw" in the list of files. The "-tw" can be anywhere in the list, so you can choose where you want the window in the stack. For example, you might put the following line in a desktop boot file:
This would boot your machine with DeskEdit on the icon bar, and with two DeskEdit windows open, one containing the file Letter, the other a task window.

You can even send your own user commands to a task window (one will be opened if there is none available). To do this, use the w command in your list of user commands in the file !DeskEdit.Data.Commands - e.g.:

or:

2s Save and Run

DeskEdit already implements save and run for Basic programs - just save with Ctrl-Sh-F3. If you are editing an Obey file or an Exec file, saving with Ctrl-Sh-F3 will cause the file to be saved as normal, but will now also execute the saved file in a task window, creating a new one if none is open.

Performing a Ctrl-Sh-F3 save when in C mode works similarly, except that here, DeskEdit searches the first few lines of the source file for the name of a file to run - which could be a Make file, or better still, an Exec or Obey file which controls the Make process. The keyword task_window is used, as in the example below:

This will cause the named file to be run from a task window (creating a new one if one is not already open).

As an added bonus, you can also include the switch -b, to send the current window to the back of the stack. This puts it out of the way until you need it (Ctrl-Sh-Enter will bring it back again). With the switch the above example becomes:

2t Key macros - keystroke recording

A system of recording DeskEdit keystrokes has been built into DeskEdit 4. Sequences can then be played back to implement repetitive tasks. The macros can be controlled from function key Ctrl-F7, which brings up a dialogue box, or from a set of 10 special key combinations.

There are ten available macro buffers for each of DeskEdit's three languages (Text, Basic and C). Each of these can be given a textual label to assist in remembering the function you have assigned to it, and each can accommodate up to 50 keypresses. All keystroke macros can be saved directly from the Save button on the Macros dialogue box.

The ten macros are associated with the letters Q-P on the second row of the keyboard. Use Esc-Sh-<key> to toggle recording on/off, and Esc-<key> to play back a macro at any time.

Thus for example if you press Escape-Sh-Q, the "Q" macro will start recording every keypress. Press the Down cursor key 3 times, then hit Escape-Sh-Q (or any other macro key since these all cancel recording), and you will have recorded a sequence of three Cursor-down movements. To use these at any time, just hit Escape-Q.

You can also control the process from the dialogue box on Ctrl-F7. Press Ctrl-F7 to display the box (or select it from the Misc edit submenu), then click on Q to select this as the current macro. You can optionally type in a memorable name of up to 11 characters (e.g. 3xCursorDwn). Click on Record to start recording, and then press Cursor down three times. Press Ctrl-F7 to stop the recording. The dialogue box will now show the length of the recording under Q. It should be 3.

Clicking on Playback will play the selected macro, while clicking on Save will save your macros to disc.

This new macro facility is very powerful, though there is just one thing that you cannot yet do with it: it will not record the keys typed into any dialogue box. If there is sufficient demand this feature may be included in a future release.

Two examples
As a first example, here is how to create a macro which will cause any word at the caret to be given italics codes. Place the caret in the middle of any word in a text file in text mode. Now start recording a key macro, and use the following four keys in sequence:

<Right-hand-Shift><Left-Cursor>(new feature - see later)
Ctrl-I
<Right-hand-Shift><Right-Cursor>(new feature - see later)
Ctrl-O

Now stop recording. Now whenever you play back this macro, the word at the caret (regardless of exactly where the caret is in the word) will receive an Italics on code at the start, and an All Codes Off code at the end. It will even work if the word is immediately followed by some form of punctuation. By a similar process you can create a macro to remove such a pair of codes, though if you apply it to a word without codes, it will simply remove the first and last letter of the word.

The second example shows how to use a macro in conjunction with a Quick Search. Suppose you want to find occurrences of variables containing the sequence _paint, and add to them the sequence my_ at the start - so that xx_paint_loader and load_paint_brush would become my_xx_paint_loader and my_load_paint_brush. This is tricky to do using Find on F4, and anyway the wildcard specifiers in Find can be pretty cumbersome. So, to use Quick Search, just initiate a Quick Search using Ctrl-F, and search for _paint. This should take you to a find. Now start recording a macro, and use the following five keys:

<Right-hand-Shift><Left-Cursor>(new feature - see later)
m
y
_(underscore)
Ctrl-N

Then stop recording.

Now every time you play back this macro it will amend the variable at the caret, and move you on to the next find. If you want to alter this find, play the macro again, or if you want to just move on to the next find without altering the current one, press Ctrl-N.

Note the way that we have put the Ctrl-N at the end of the macro sequence, to give us the option of rejecting the replace.

2u Auto-finder for Basic Errors

DeskEdit 4 now provides a mechanism for taking you straight to reported error lines in Basic. To make it work you must include the following short statement in your error handler:
This has been set up as a Basic text macro for ease of use on Ctrl-1 (use the left-hand Ctrl key with the numeric keypad). The way it works is to set the system variable DeskEdit$ERL to the error line number.

Once your program hits an error, just press Ctrl-G (for Goto Error Line), in the DeskEdit window containing the source file, and you will be taken to the error line. And this works regardless of whether your program is neatly numbered by tens or not. Note that DeskEdit's throwback window must be closed for this to work, since Ctrl-G is also used to take you to the next throwback line.

The new invisible marker on Escape-G will take you back to where you were before you issued a Ctrl-G.

2v A General goto

A second system variable:
has been set aside for the user. It works in a similar way to the Basic Error line finder above, but it operates from Ctrl-Sh-G, and is active in all of DeskEdit's three languages (Text, Basic and C). Note that it will only operate when DeskEdit's throwback window is closed, because when it is open Ctrl-Sh-G takes you to the next throwback line (upwards through the file).

To make it work, simply set this variable to the line number required, and then press Escape-G in any window to go to that line number. One use for this would be in Basic or C programs which handle data or text files. Your program could check through a data file, and if it came to an error, it could report the error in the normal way, but also set DeskEdit$goto to the line number in the data file where the data needs editing. All you do then is press Escape-G from the DeskEdit window holding the data file, and you will be taken straight to the error line. There are I am sure, many other uses for this trick, and if you come across any interesting ones, please write in.

The new invisible marker on Escape-G will take you back to where you were before you issued a Ctrl-Sh-G.

2w Printer Fixes

DeskEdit 4 contains two new overrides to help with the problem of excess pages being printed with some of the RISC OS 3 printer drivers.

The override printer_formfeeds can now be set to "yes". This simply replaces the very last line-feed on each page with a page-feed. This avoids the problem with some drivers which resulted in double page feeds. The earlier solution of using artificially long page lengths is now redundant, so the driver page size should now be set to exactly match the size in DeskEdit's Page set up dialogue box.

Additionally the override printer_endfeeds can be set to "no" to stop the last page being pushed out. The drivers normally issue a page feed as part of the end of job sequence, so this avoids a double page at the end.

To set these overrides, you will need to load the file DeskEdit$Choices.Overrides into DeskEdit, and remove the leading slash from the lines:

2x Minor Features

DeskEdit 4 also contains a considerable number of additional minor improvements, including the following:

  1. Returning with Escape: The new key combination Escape-. (Hold down Escape, and hit the full stop on the numeric keypad), will take you to where you were before you used any of the specific position finders (e.g. those activate with Esc-!, '@', '#' etc, and after Sh-Ctrl-/, '*', '#', '-', '+', and '.'.
    Note that even on RISC OS 3 you can still use the specific position finders on the symbol keys on the numeric keypad. Thus while Ctrl-Sh-! no longer works, Ctrl-Sh-/ etc. does.

  2. Calculator binary entry: Clicking with Adjust on the Shift Left calculator button (i.e. the button labelled "<<") or the Shift Right button enters a 1. This means you can use Shift Left to enter binary numbers - using Select to enter a zero, and Adjust to enter a one.

  3. The key for centring text has now been moved from Escape-R to Ctrl-Sh-K to leave room for the new macro recording keys.

  4. Two new key combinations have been implemented to move the caret to the start or end of a word. This is particularly useful for including in Key macros etc, and takes account of punctuation. The keys, which use the Right-hand Shift key in conjunction with the Left or Right cursor keys are:
    <Right-hand-Shift><Left-Cursor>Go to start of word
    <Right-hand-Shift><Right-Cursor>Go to end of word

  5. The new key combination:

    can be used to right-align comments in C source code. Thus the lines:

    int i; /* loop variable */
    char string[100]; /* temporary string */
    dbox d; /* prog info dialogue box */

    would become:

    int i;/* loop variable */
    char string[100];/* temporary string */
    dbox d;/* prog info dialogue box */

    after pressing Escape-Tab three times (since it moves on to the next line after alignment), and it doesn't matter where on the line the caret is positioned. It takes the length of the line from the width as set on Escape-F5.

  6. DeskEdit 4 now fully supports the C++ convention of using a double slash to indicate that the rest of the line is to be ignored. To set up DeskEdit 4 for use with C++ remarks, Menu over Language and C from the window menu on a C source, and click on "C++". To ensure that DeskEdit starts with this option as default, perform a Choices save via the main menu.

  7. As in DeskEdit 2, dragging a directory to the DeskEdit icon sets the current directory to the dragged item. But with DeskEdit 3 & 4 you can set the current directory to the parent of a dragged item. Dragging an object with Alt-Ctrl pressed sets the current directory to the parent of the dragged item.
    This can be useful if you want to make the root directory into the CSD (not easily achieved before), or if you have a directory open on the desktop and want to make it the CSD.

  8. The Dustbin application supplied with DeskEdit will now delete any DeskEdit datafile associated with text and other files dragged to it (i.e. datafiles created during extended saves). The datafile cannot however be retrieved from the Dustbin.

Copyright © Lee Calcraft October 1994

Published by BEEBUG Ltd, 117 Hatfield Road, St Albans, Herts AL1 4JS. Tel. 0727 840303